package com.imau.brand.controller;

import com.alibaba.fastjson.JSON;
import com.imau.brand.service.BrandService;
import com.imau.brand.service.impl.BrandServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/brandDelBatch")
public class BrandDelBatchController extends HttpServlet {

    /**初始化业务层对象*/
    private BrandService brandService = new BrandServiceImpl();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        String strIds = request.getReader().readLine();
        Integer[] ids = JSON.parseObject(strIds, Integer[].class);
        boolean b = brandService.deleteBatchByIds(ids);

        response.getWriter().write(b+"");

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
